
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
<head>

<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />

<style type="text/css">

input:readonly
{
background:#CDCCCE;
}
</style>

<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />

<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />



<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-article-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>盘点单号</label>
		<div class="formControls col-xs-8 col-sm-8"> 
			
		<input type="text" class="input-text" readonly  value="${requestScope.takId}" placeholder="" id="takId" name="">
				
				</div>
				
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>仓库</label>
		<div class="formControls col-xs-8 col-sm-8"> 
			
		<input type="text" class="input-text" readonly  value="${requestScope.stoName}" placeholder="" id="stoName" name="">
				
				</div>
				
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>商品条码</label>
			<div class="formControls col-xs-8 col-sm-8">
				<input type="text" class="input-text" readonly value="${requestScope.ProBarCode}" placeholder="" id="proBarCode" name="">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">商品名称</label>
				<div class="formControls col-xs-8 col-sm-8">
				<input type="text" class="input-text" readonly value="${requestScope.ProName}" placeholder="" id="proName" name="">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">规格</label>
			<div class="formControls  col-xs-8 col-sm-8">
				<input type="text" class="input-text" readonly value="${requestScope.ProName}" placeholder="" id="proQual" name="">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">单位</label>
				<div class="formControls  col-xs-8 col-sm-8">
				<input type="text" class="input-text" readonly value="${requestScope.ProUnit}" placeholder="" id="proUnit" name="">
			</div>
		
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">盈亏数量</label>
			<div class="formControls  col-xs-8 col-sm-8">
				<input type="text" class="input-text" readonly value="${requestScope.PhaseNum}" placeholder="" id="proLossNum" name="">
			</div>
			</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">报损报溢数量</label>
			<div class="formControls  col-xs-8 col-sm-8">
				<input type="text" class="input-text" value="" placeholder="" id="proNum" name="reportNum">
			</div>
			</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">单价</label>
			<div class="formControls col-xs-8 col-sm-8">
				<input type="text" name="" id="purchPrice" readonly value="${requestScope.ProPurchPrice}" placeholder="" class="input-text">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">总金额</label>
			
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"></label>
			<div class="formControls col-xs-8 col-sm-8">
				<input type="text" name="" readonly id="countPrice" placeholder="" value="" class="input-text" style="width:90%">
				</div>
		</div>
	
	


		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>报损原因</label>
			<div class="formControls col-xs-8 col-sm-8">
				<textarea name="" cols="" rows="" id="lossReason" class="textarea"  placeholder="填写报损原因" datatype="*10-100" dragonfly="true" nullmsg="不能为空" onKeyUp="$.Huitextarealength(this,200)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
			</div>
		</div>
		
	
		<div class="row cl">
			
			<div class="formControls col-xs-8 col-sm-9"> 
				<script id="editor" type="text/plain" style="width:100%;height:400px;"></script> 
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button id="lossSave" class="btn btn-primary radius"  type="button"><i class="Hui-iconfont">&#xe632;</i>报损报溢</button>			
				<button  class="btn btn-default radius" type="reset">&nbsp;&nbsp;重置&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</div>

<!--_footer ä½ä¸ºå¬å±æ¨¡çåç¦»åºå»-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer ä½ä¸ºå¬å±æ¨¡çåç¦»åºå»-->

<!--è¯·å¨ä¸æ¹åæ­¤é¡µé¢ä¸å¡ç¸å³çèæ¬-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$list = $("#fileList"),
	$btn = $("#btn-star"),
	state = "pending",
	uploader;

	var uploader = WebUploader.create({
		auto: true,
		swf: 'lib/webuploader/0.1.5/Uploader.swf',
	
		// æä»¶æ¥æ¶æå¡ç«¯ã
		server: 'lib/webuploader/0.1.5/server/fileupload.php',
	
		// éæ©æä»¶çæé®ãå¯éã
		// åé¨æ ¹æ®å½åè¿è¡æ¯åå»ºï¼å¯è½æ¯inputåç´ ï¼ä¹å¯è½æ¯flash.
		pick: '#filePicker',
	
		// ä¸åç¼©image, é»è®¤å¦ææ¯jpegï¼æä»¶ä¸ä¼ åä¼åç¼©ä¸æåä¸ä¼ ï¼
		resize: false,
		// åªåè®¸éæ©å¾çæä»¶ã
		accept: {
			title: 'Images',
			extensions: 'gif,jpg,jpeg,bmp,png',
			mimeTypes: 'image/*'
		}
	});
	uploader.on( 'fileQueued', function( file ) {
		var $li = $(
			'<div id="' + file.id + '" class="item">' +
				'<div class="pic-box"><img></div>'+
				'<div class="info">' + file.name + '</div>' +
				'<p class="state">ç­å¾ä¸ä¼ ...</p>'+
			'</div>'
		),
		$img = $li.find('img');
		$list.append( $li );
	
		// åå»ºç¼©ç¥å¾
		// å¦æä¸ºéå¾çæä»¶ï¼å¯ä»¥ä¸ç¨è°ç¨æ­¤æ¹æ³ã
		// thumbnailWidth x thumbnailHeight ä¸º 100 x 100
		uploader.makeThumb( file, function( error, src ) {
			if ( error ) {
				$img.replaceWith('<span>ä¸è½é¢è§</span>');
				return;
			}
	
			$img.attr( 'src', src );
		}, thumbnailWidth, thumbnailHeight );
	});
	// æä»¶ä¸ä¼ è¿ç¨ä¸­åå»ºè¿åº¦æ¡å®æ¶æ¾ç¤ºã
	uploader.on( 'uploadProgress', function( file, percentage ) {
		var $li = $( '#'+file.id ),
			$percent = $li.find('.progress-box .sr-only');
	
		// é¿åéå¤åå»º
		if ( !$percent.length ) {
			$percent = $('<div class="progress-box"><span class="progress-bar radius"><span class="sr-only" style="width:0%"></span></span></div>').appendTo( $li ).find('.sr-only');
		}
		$li.find(".state").text("ä¸ä¼ ä¸­");
		$percent.css( 'width', percentage * 100 + '%' );
	});
	
	// æä»¶ä¸ä¼ æåï¼ç»itemæ·»å æåclass, ç¨æ ·å¼æ è®°ä¸ä¼ æåã
	uploader.on( 'uploadSuccess', function( file ) {
		$( '#'+file.id ).addClass('upload-state-success').find(".state").text("å·²ä¸ä¼ ");
	});
	
	// æä»¶ä¸ä¼ å¤±è´¥ï¼æ¾ç¤ºä¸ä¼ åºéã
	uploader.on( 'uploadError', function( file ) {
		$( '#'+file.id ).addClass('upload-state-error').find(".state").text("ä¸ä¼ åºé");
	});
	
	// å®æä¸ä¼ å®äºï¼æåæèå¤±è´¥ï¼åå é¤è¿åº¦æ¡ã
	uploader.on( 'uploadComplete', function( file ) {
		$( '#'+file.id ).find('.progress-box').fadeOut();
	});
	uploader.on('all', function (type) {
        if (type === 'startUpload') {
            state = 'uploading';
        } else if (type === 'stopUpload') {
            state = 'paused';
        } else if (type === 'uploadFinished') {
            state = 'done';
        }

        if (state === 'uploading') {
            $btn.text('æåä¸ä¼ ');
        } else {
            $btn.text('å¼å§ä¸ä¼ ');
        }
    });

    $btn.on('click', function () {
        if (state === 'uploading') {
            uploader.stop();
        } else {
            uploader.upload();
        }
    });

});


$("#proNum").change(function()
		{
	$("#countPrice").val($("#purchPrice").val()*parseInt($(this).val()));
		})
		
		$("#lossSave").click(function()				
		{ 
			$.post('SaveProLossMsgServlet',{
				takId:$("#takId").val(),
				stoName:$("#stoName").val(),
				proBarCode:$("#proBarCode").val(),
				proNum:$("#proNum").val(),
				countPrice:$("#countPrice").val(),
				lossReason:$("#lossReason").val(),
				proLossNum:$("#proLossNum").val()
				},
			callback)
			
		})
		function callback(data)
		{
	if(data=="报损成功")
	    
		{
		layer.confirm('您确定要提交?',{
			btn:['确定','取消']	
		},
		function()
		{
			layer.msg('提交成功',{icon:1})
			$("#lossSave").attr('disabled',true);
		},function()
		{
			layer.msg('取消成功',{icon:1})
			
		})
		
		}
	else
		alert("报损失败");
		}
		
	

</script>
</body>
</html>
